home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 September / PCWorld_2006-09_cd.bin / komercni software / zoner / zps8_cz.exe / {app} / HTMLPublish / compactPHP.zht / setpass.php < prev    next >
PHP Script  |  2006-03-22  |  1KB  |  59 lines

  1. <?php
  2.   include("fn.php");
  3.   $pass="";
  4.   if (isset($_POST["Password"]))
  5.     $pass=md5(charEncode($_POST["Password"]));
  6.   include("getpass.php");
  7.  
  8.   $report=<<<ENDH
  9. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  13. <title>Chyba</title>
  14. </head>
  15. <body>
  16. <br>
  17. %message%<br>
  18. <a href="admin.php">Zp─¢t</a>
  19. </body>
  20. </html>
  21. ENDH;
  22.    
  23.   if (isset($_GET['COOKIE_SET']))
  24.   {
  25.       $lpass="";
  26.       if (isset($_COOKIE['zpsgallery']))
  27.         $lpass=$_COOKIE['zpsgallery'];
  28.       if (!passwordvalid($lpass))
  29.       {
  30.         $report=str_replace("%message%","Nepoda┼Öilo se vytvo┼Öit cookie",$report);
  31.         echo $report;      
  32.       }
  33.       else     
  34.       {
  35.         echo "<meta http-equiv=\"refresh\" content=\"0; url=admin.php\">";
  36.       }
  37.   }  
  38.   else
  39.   {
  40.     if (!passwordvalid($pass))
  41.     {
  42.         $report=str_replace("%message%","Zadan├⌐ heslo je neplatn├⌐",$report);
  43.         echo $report;
  44.     }
  45.     else
  46.     {
  47.       if (!setcookie("zpsgallery",$pass, time()+3600))
  48.       {
  49.         $report=str_replace("%message%","Nepoda┼Öilo se vytvo┼Öit cookie",$report);
  50.         echo $report;
  51.       }
  52.       else
  53.       {    
  54.         header("Location: $PHP_SELF?COOKIE_SET=1") ;
  55.       }
  56.     }
  57.   }
  58. ?>
  59.